package cn.alex.sso.project.sync.event;

import lombok.Getter;
import org.springframework.context.ApplicationEvent;

import java.util.List;

/**
 * 数据同步事件基类
 *
 * @author Alex
 * @date 2024/12/1 02:24
 */
@Getter
public abstract class AbstractDataSyncEvent extends ApplicationEvent {
    private final Object data;
    private final String module;
    private final String trigger;

    public AbstractDataSyncEvent(Object source, Object data, String module, String trigger) {
        super(source);
        this.data = data;
        this.module = module;
        this.trigger = trigger;
    }

    /**
     * 自定义需要同步的应用
     *
     * @return 应用ID列表
     */
    public abstract List<Long> customSyncClient();

    /**
     * 自定义处理需要同步的数据
     *
     * @param data 需要同步的数据
     * @return 结果
     */
    public abstract Object customProcess(Object data);
}
